<?=$this->header()?>


    <?=$this->menu("forums")?>


    <h1><?=$this->message("label.reply.header", _Forum::BUNDLE)?></h1>


    <? /* Breadcrums route & user info display */ ?>
    <?=$this->route(
        array(
            array(
                "name"=>$this->message("label.category.header", _Forum::BUNDLE),
                "href"=>"forum/category/list"
            ),
            array(
                "name"=>$this->category($this->replies($this->replyListForm)->getTopic()->getCategoryId()),
                "href"=>"forum/list?id=".$this->replies($this->replyListForm)->getTopic()->getCategoryId()
            ),
            $this->message("label.replies.for", _Forum::BUNDLE) . " \"" . $this->replies($this->replyListForm)->getTopic()->getName() ."\""
        ),
        $this->replyListForm,                            // ListForm (for reply info, see float right)
        $this->replies($this->replyListForm)->getRows()) // The total amount of replies
    ?>


    <? /* Show status messages */ ?>
    <?=$this->messages(_Core::BUNDLE)?>


    <? /* Show error messages */ ?>
    <?=$this->errors(null)?>


    <form id="<?=get_class($this->replyListForm)?>"
          method="post"
          action="forum/reply/list"
          onsubmit="return confirmDelete('<?=$this->message("message.confirm.delete", _Core::BUNDLE)?>', this)">


        <? /* Show the Search & Filter Panel */ ?>
        <?=$this->panel(
            "forum/reply/edit?reply->topicId=".$this->replyListForm->getId(), // Add New URL
            $this->replyListForm, // ListForm
            array(                // Filter fields
                TopicReplyPeer::BODY=>$this->message("prompt.body", _Forum::BUNDLE),
                TopicReplyPeer::USERNAME=>$this->message("label.username", _Forum::BUNDLE),
                TopicReplyPeer::MODIFIED_DATE=>$this->message("choose.modified", _Core::BUNDLE),
                TopicReplyPeer::INSERT_DATE=>$this->message("choose.created", _Core::BUNDLE),
                TopicReplyPeer::ACTIVE=>$this->message("choose.active", _Core::BUNDLE)
            ),
            false // No languages for this page.
        )?>


        <? /* Start output buffering in case there are no results */ ?>
        <?$this->start()?>


        <table class="list" cellspacing="0" cellpadding="0">
        <tr>
            <th class="checkbox"></th>
            <th>
                <?=$this->TH(
                    $this->replyListForm,                         // ListForm
                    TopicReplyPeer::BODY,                         // Sort Field
                    $this->message("prompt.body", _Forum::BUNDLE) // Header Name
                )?>
            </th>
            <th class="narrow">
                <?=$this->TH(
                    $this->replyListForm,     // ListForm
                    TopicReplyPeer::USERNAME, // Sort Field
                    $this->message("label.username", _Forum::BUNDLE) // Header Name
                )?>
            </th>
            <th class="narrow">
                <?=$this->TH(
                    $this->replyListForm,          // ListForm
                    TopicReplyPeer::MODIFIED_DATE, // Sort Field
                    $this->message("choose.modified", _Core::BUNDLE)  // Header Name
                )?>
            </th>
            <th class="narrow">
                <?=$this->TH(
                    $this->replyListForm,        // ListForm
                    TopicReplyPeer::INSERT_DATE, // Sort Field
                    $this->message("choose.created", _Core::BUNDLE)  // Header Name
                )?>
            </th>
            <th class="narrow" title="<?=$this->message("title.active", _Core::BUNDLE)?>">
                <?=$this->TH(
                    $this->replyListForm,       // ListForm
                    TopicReplyPeer::ACTIVE,     // Sort Field
                    $this->message("label.active", _Core::BUNDLE) // Header Name
                )?>
            </th>
            <th class="buttons"></th>
        </tr>

        <? foreach($this->replies($this->replyListForm)->getItems() as $reply) { ?>

            <? /* Display the default language reply */ ?>
            <tr class="ctrl">
                <td class="checkbox">

                    <input type="checkbox"
                           name="items[]"
                           value="<?=$reply->getTopicReplyId()?>"
                           <?=in_array($reply->getTopicReplyId(), $this->replyListForm->getItems()) ? " checked=\"checked\"" : ""?> />

                </td>
                <td class="html"><?=$reply->getBody()?></td>
                <td>
                    <a title="<?=$this->message("title.username", _Forum::BUNDLE)?>" href="mailto:<?=$reply->getUsername()?>">
                        <?=$this->truncateNicely($reply->getUsername(), 16, 18, "...")?>
                    </a>
                </td>
                <td title="<?=$this->message("title.modified", _Core::BUNDLE)?> <?=$reply->getModifiedDate(_Core::FORMAT_DATETIME)?>">
                    <?=$reply->getModifiedDate(_Core::FORMAT_DATE)?>
                </td>
                <td title="<?=$this->message("title.created", _Core::BUNDLE)?> <?=$reply->getInsertDate(_Core::FORMAT_DATETIME)?>">
                    <?=$reply->getInsertDate(_Core::FORMAT_DATE)?>
                </td>
                <td title="<?=$this->message("title.active", _Core::BUNDLE)?>">
                    <?=$this->message("label." . ($reply->getActive() ? "yes" : "no"), _Core::BUNDLE)?>
                </td>
                <td class="buttons">

                    <input type="button"
                           onclick="to('forum/reply/edit?reply->topicReplyId=<?=$reply->getTopicReplyId()?>')"
                           class="button"
                           value="<?=$this->message("button.edit", _Core::BUNDLE)?>" />

                    <input type="button"
                           onclick="del(<?=$reply->getTopicReplyId()?>, '<?=get_class($this->replyListForm)?>')"
                           class="button"
                           value="<?=$this->message("button.delete", _Core::BUNDLE)?>" />
                </td>
            </tr>

        <? } ?>

        </table>


        <? /* Edit/Action Bar for checkboxed */ ?>
        <?=$this->edit(
            $this->replyListForm, // ListForm
            array(                // The actions
                "activate"=>$this->message("choose.activate", _Core::BUNDLE),
                "deactivate"=>$this->message("choose.deactivate", _Core::BUNDLE),
                "delete"=>$this->message("choose.delete", _Core::BUNDLE)
            )
        )?>


        <? /* End output buffering */ ?>
        <?$this->end(
            $this->replyListForm,                                             // ListForm
            "forum/reply/edit?reply->topicId=".$this->replyListForm->getId(), // Add New URL
            $this->replies($this->replyListForm)->getRows()                   // The total amount of replies
        )?>


    </form>

<?=$this->footer()?>